export default { 
  render(h) {
    // 标记当前router-view深度
    this.$vnode.data.routerView = true

    let depth  = 0
    let parent = this.$parent
    while (parent) {
      const vnodeData = parent.$vnode && parent.$vnode.data
      if (vnodeData) {
        if (vnodeData.routerView) {
          // 说明是一个router-view
          depth++ 
        }
      }
      parent = parent.$parent
    }

    let component = null
    const route = this.$router.matched[depth]
    if (route) {
      component = route.component || null
    }
    return h(component)
  }
}

// 1.router-viewd的深度标记
// 2.路由匹配时获取深度匹配的路由
